<?php
	include_once("../include/init.php");

	//extract($_POST);
	extract($_POST);
	//print_r($_POST);

	if(!isset($sub)){
		msg("请从表单提交","login.php");
		exit;
	}
	$user = trim($username);
	$pwd = md5(trim($password));
	$sql= "select * from tk_user where user = '$user' and password = '$pwd'";

	 $res = mysql_query($sql);
	 if(mysql_num_rows($res)>0){
	 	$_SESSION['user'] = $user;
	 	$info  = mysql_fetch_assoc($res);
	 	 $_SESSION['uid'] = $info['uid'];

	 	msg("登录成功","index.php");

	 }else{
	 	msg("登录失败","login.php");
	 }


?>